<script setup lang="ts">
const goToOptions = () => {
  const url = chrome.runtime.getURL('src/options/index.html')
  window.open(url, '_blank')
}
</script>

<template>
  <header
    aria-label="Site Header"
    class="bg-gray-50"
  >
    <div class="navbar bg-base-100">
      <div class="navbar-start">
        <div class="dropdown">
          <div
            tabindex="0"
            role="button"
            class="btn btn-ghost btn-circle"
            @click="goToOptions"
          >
            <svg
              xmlns="http://www.w3.org/2000/svg"
              class="h-5 w-5"
              fill="none"
              viewBox="0 0 24 24"
              stroke="currentColor"
            >
              <path
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
                d="M4 6h16M4 12h16M4 18h7"
              />
            </svg>
          </div>
        </div>
      </div>
      <div class="navbar-center">
        <a class="btn btn-ghost text-xl">
          <RouterLink to="/">云开月明页面监控</RouterLink>
        </a>
      </div>
      <div class="navbar-end">
        <button class="btn btn-ghost btn-circle">
          <RouterLink
            class="underline"
            to="/login"
          >
            登录
          </RouterLink>
        </button>
        <button
          class="btn btn-ghost btn-circle"
          @click="goToOptions"
        >
          <div class="indicator">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              class="h-5 w-5"
              fill="none"
              viewBox="0 0 24 24"
              stroke="currentColor"
            >
              <path
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
                d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
              />
            </svg>
            <span class="badge badge-xs badge-primary indicator-item"></span>
          </div>
        </button>
      </div>
    </div>
  </header>

  <RouterView />
</template>

<style scoped></style>
